package cc.togetherit.jcrawler.crawler;

import cc.togetherit.jcrawler.checkRepeat.MemRepeatCheck;
import cc.togetherit.jcrawler.down.DownEngineFactory;
import cc.togetherit.jcrawler.fetch.FetchEngineFactory;
import cc.togetherit.jcrawler.parse.ParseEngineFactory;

public class JdkXpathMemPoolCrawlerContenxt extends MemPoolCrawlerContext {

    public JdkXpathMemPoolCrawlerContenxt(CrawlerConfig config) {
        super(config);
    }

    @Override
    public void buildPersistenceEngine() {
        setPersitenceEngine(ParseEngineFactory.getPersistenceEngine(getParsePool(), getPersitencePool(), getConfig().getParseConfig(), null));
    }

    @Override
    public void buildParseEngine() {
        setParseEngine(ParseEngineFactory.getParseEngine(getParsePool(), getPersitencePool(), getConfig().getParseConfig(), null));

    }

    @Override
    public void buildFetchEngine() {
        setFetchEngine(FetchEngineFactory.getEngine(FetchEngineFactory.XPATH, getDownLoadPool(), getFetchPool(), getParsePool(), new MemRepeatCheck()));

    }

    @Override
    public void buildDownEngine() {
        setDownEngine(DownEngineFactory.getEngine(DownEngineFactory.JDK, getDownLoadPool(), getFetchPool()));

    }

}
